﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DNA.Mvc.Exporting.Exporters
{
    public class WebResExporter:FilesExporter
    {
        public override void Execute(ExportingContext context)
        {
            var web = GetMatch<Web>(context);
            string source = "";
            string destination = "shared\\_user_\\";

            if (web.IsRoot)
                source = context.HttpContext.Server.MapPath("~/shared/public/");
            else
                source = context.HttpContext.Server.MapPath(string.Format("~/shared/personal/{0}/", web.Name));
            
            string directory = context.Destination + (context.Destination.EndsWith("\\") ? "" : "\\") + "content\\" + destination;

            ExportTo(context, source, directory);
        }


    }
}
